using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using BingZi.HY.Core;
using BingZi.WebControls;
using BingZi.HY.Core;
using System.Collections.Generic;

namespace BingZi.ModuleManager
{
    public partial class List : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                ListBind();
            }
        }

        private void ListBind()
        {

            NewLife.QueryParam qp = new NewLife.QueryParam();
            qp.OrderType = 0;
            qp.Orderfld = "A_Order";
            qp.PageIndex = Pager.CurrentPageIndex;
            qp.PageSize = Pager.PageSize;
            int RecordCount = 0;
            List<sys_Applications> lst = BusinessFacade.sys_ApplicationsList(qp, out RecordCount);
            GridView1.DataSource = lst;
            GridView1.DataBind();
            this.Pager.RecordCount = RecordCount;
        }

        protected void Pager_PageChanged(object sender, EventArgs e)
        {
            ListBind();
        }

        public int GetCatCount(int ApplicationID)
        {
            NewLife.QueryParam qp = new NewLife.QueryParam();
            qp.Orderfld = " M_OrderLevel ";
            qp.OrderType = 0;
            qp.Where.Add(new NewLife.SearchParam(sys_Module._.M_ApplicationID, ApplicationID, global::NewLife.SearchType.Equal));
            qp.Where.Add(new NewLife.SearchParam(sys_Module._.M_ParentID, 0, global::NewLife.SearchType.Equal));
            //qp.Where = string.Format("Where M_ApplicationID ={0} and M_ParentID=0 ", ApplicationID);
            int RecordCount = 0;
            //List<sys_Module> lst = BusinessFacade.sys_ModuleList(qp, out RecordCount);
           RecordCount = sys_Module.FindCount(qp);
            return RecordCount;
        }
    }
}